

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
  
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <title>Quản lý site</title>
<link rel="stylesheet" type="text/css" href="../resource/css/login.css"  />
</head>
<body>
<?php
	include("connectDB.php");
	if(isset($_POST["ok"]))
	{		
		$uname=$pass="";
		if($_POST["txt_username"]==null)
		{
			echo"tên đăng nhập không được để trống";
		}else
		{
				$uname=$_POST["txt_username"];
		}
		if($_POST["txt_password"]==null)
		{
			echo"mật khẩu không được để trống";
		}else
		{
				$pass=$_POST["txt_password"];
		}
		if($uname && $pass)
		{
				$sql="select*from useradmin where taikhoan='".$uname."'and matkhau='".$pass."'";
				$query=mysql_query($sql);
				if(mysql_num_rows($query)==0)
				{					
					header("Location: index.php");	
					
				}else
				{
					
					session_start();
					$_SESSION["user"]=$uname;
					header("Location:adm.php");	
				}
		}					

	}
	?>
<div id="wrapper">

    <div id="main">
        <div class="login">
            <h2>Hệ Thống Đăng Nhập</h2>
            <div class="lock">
                <img src="../resource/pictures/lock.png"/>
            </div>
             <div id="login-content">
                <div>
                    <div>                    
                        <form class="loginform" method="post" action="index.php" >
                            <ul>                           
                                <li>
                                    <label>Tài khoản</label>
                                    <input name="txt_username" id="username" maxlength="" type="text">
                                </li>
                                <li>
                                    <label>Mật khẩu</label>
                                    <input name="txt_password" id="password" maxlength="" type="password">
                                </li>
                                
                            </ul>
                            <div id="smb">                            
                               
                                <input name="ok" class="submitform" value="Đăng nhập" type="submit">
                            </div>
                        </form>
                        <p style="text-align:right; padding:23px; color: #ebebeb">
                          <!--  <a class="lostpass" title="Quên mật khẩu" href="#">Quên mật khẩu?</a> -->
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body></html>